package com.hqhy.like.stock.dao.persist.repository.impl;

import com.hqhy.like.stock.dao.persist.mapper.CategoryMapper;
import com.hqhy.like.stock.dao.persist.repository.ICategoryRepository;
import com.hqhy.like.stock.pojo.entity.Category;
import com.hqhy.like.stock.pojo.vo.CategoryListItemVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Slf4j
@Repository
public class CategoryRepositoryImpl implements ICategoryRepository {

    @Autowired
    private CategoryMapper categoryMapper;

    @Override
    public int insert(Category category) {
        log.debug("开始执行【插入类别】的数据访问，参数：{}", category);
        return categoryMapper.insert(category);
    }

    @Override
    public int deleteById(Long id) {
        log.debug("开始执行【根据id删除类别】的数据访问,参数: {}",id);
        return categoryMapper.deleteById(id);
    }

    @Override
    public int updateById(Category category) {
        log.debug("开始执行【根据id修改类别】的数据访问,参数: {}",category);
        return categoryMapper.updateById(category);
    }

    @Override
    public List<CategoryListItemVO> list() {
        log.debug("开始执行【显示类别列表】的数据访问");
        return categoryMapper.list();
    }




}
